#include <funcs.h>
#include <x86.h> /* disable() */
int timer_ticks = 0;
int bsecond = 0;
int bminute = 0;
int bhour = 0;
int bios_call(int data_a);
void timer_irq(void)
{
    /* Increment our 'tick count' */
    timer_ticks++;

	
    /* Every 18 clocks (approximately 1 second), we will
    *  display a message on the screen */
    if (timer_ticks % 18 == 0)
    {
        //kprintf("One second has passed\n");
		//One Second Period...
		bsecond++;


    }
    if (timer_ticks % 1080 == 0)
    {
        //kprintf("One second has passed\n");
		//One Second Period...
		bminute++;


    }	
    if (timer_ticks % 64800 == 0)
    {
        //kprintf("One second has passed\n");
		//One Second Period...
		bhour++;


    }	
	txt_gui();

}



void timer_wait(int ticks)
{
    int eticks;
    eticks = timer_ticks + ticks;

	while (timer_ticks < eticks);
		schedule();
	



}
int bcd2dec(int bcd)
{
return (bcd-((bcd>>4)*6)); 
}	


void delay2(int secs)
{
    asm("movl %0, %%ebx":: "r"(secs));
    asm("movl $0x08, %eax");
    asm("int $0x30");
}
void delay(int secs)
{
	int secs2;
	secs2 = secs;
	
int x;
while (secs2--)
{
x = bios_call(0);
while (bios_call(0) == x);
}
return;
}


int bios_call(int data_a)
{
int data_b;
outportb(0x70, data_a);
data_b = inportb(0x71);
return data_b;
}
